About 613 letters

About 3 minutes

#map

Description: Map an iterable object.

def map(fn, iterable):
    '''
    Map an iterable object

    :param fn: A callback function that returns the mapped value of each element
    :param iterable: The iterable object to be mapped
    :return: The mapped iterable object
    '''

Example:

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print(map(lambda x : x**2, numbers))
print(list(map(lambda x : x**2, numbers)))

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

Updated: 6/9/2025

Author: PlanC

Created: 6/9/2025